package com.lefevre.cms.web.action;

import com.lefevre.cms.service.theme.ThemeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 首页
 *
 * @author Lefevre
 */
@Controller
public class IndexController {

    @Resource
    AccessDeviceUtil accessDeviceUtil;

    @Resource(name = "themeServiceImpl")
    private ThemeService themeService;

    @RequestMapping(value = {"/", "/index"})
    public String execute(HttpServletRequest request) throws Exception {
        String dirName = themeService.findTemplateDir_cache();
        return "/templates/" + dirName + "/" + accessDeviceUtil.accessDevices(request) + "/index";
    }

}
